www.mxdraw.com
|
实体id返回实体对象
[helpstring("method ObjectIdToObject")] HRESULT ObjectIdToObject([in] LONGLONG lId, [out,retval] IMxDrawMcDbObject** ppObject);
参数 |
说明 |
[in] LONGLONG lId |
实体id |
例如: JS代码,中绘一个直线,得到直线id,再调该得到直线对象,然写扩展数据的例子.
function DoCommandEventFunc(iCmd) { if (iCmd == 1) { var mxOcx = document.all.item("MxDrawXCtrl"); mxOcx.focus(); var point1 = mxOcx.GetPoint(null,"n 点取开始点:"); if(point1 == null) { return; } var point2 = mxOcx.GetPoint(point1,"n 点取结束点:"); if(point1 == null) { return; } // 直线的id var lineId = mxOcx.DrawLine(point1.x,point1.y,point2.x,point2.y); // 为新写的直线写一个字符串扩展数据 var database = mxOcx.GetDatabase(); var ent = database.ObjectIdToObject(lineId); if(ent == null) { return; } var exData = mxOcx.Call("Mx_NewResbuf",""); exData.AddString("TestApp",1001); exData.AddString("用户的扩展数据内容。。。",1000); ent.SetXData(exData); } }